package com.hoongs.v1.utils;

import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class PResult {
    public Long total;
    public List<?> rows;

    public PResult(IPage<?> iPage) {
        this.total = iPage.getTotal();
        this.rows = iPage.getRecords();
    }

    /**
     * 检查分页参数是否为空
     */
    public static Boolean checkPageQuery(Integer page, Integer size) {
        return page != null && page > 0 && size != null && size > 0;
    }
}
